package com.visualize.demo.model;

import lombok.Getter;
import lombok.Setter;

import java.util.Date;

public class FiveEmotionPercent {

    public FiveEmotionPercent(float sum, Integer grief, Integer evil, Integer happiness, Integer fear, Integer anger, Date time) {
        if (sum == 0) {
            this.grief = 0;
            this.evil = 0;
            this.happiness = 0;
            this.fear = 0;
            this.anger = 0;
        } else {
            this.grief = grief / sum;
            this.evil = evil / sum;
            this.happiness = happiness / sum;
            this.fear = fear / sum;
            this.anger = anger / sum;
        }
        this.time = time;
    }

    @Getter
    @Setter
    private float grief;     //哀

    @Getter
    @Setter
    private float evil;      //恶

    @Getter
    @Setter
    private float happiness; //喜

    @Getter
    @Setter
    private float fear;      //惧

    @Getter
    @Setter
    private float anger;     //怒

    @Getter
    @Setter
    private Date time;

}
